<template>
  <div id="box">
    <div class="head-box">
      <span class="iconfont icon-guanbi"  @click="$router.back(-1)"></span>
      <span>帮助</span>
    </div>
    <div class="m-box">
      <p class="welcom">欢迎来到猫眼</p>
      <div class="tel-number">
        <span>+86 > </span><input type="text" placeholder="请输入手机号" v-model="userPhone" />
        <!-- @blur="blurFn" -->
      </div>
      <div class="tel-number">
        <span>密码> </span> <input type="text" placeholder="请输入密码" v-model="userPassword" />

      </div>
      <!--<div class="agree">-->
        <!--<input type="checkbox" /><span>我已阅读并同意<i>《猫眼用户服务协议》、《隐私政策》</i>-->
          <!--并授权猫眼使用该猫眼账号信息(如昵:称、头像、收货地址) 以便统一管理 '-->
        <!--</span>-->
      <!--</div>-->
      <p class="denglv" @click="denglvFn">登录</p>
      <p class="mima">
        <router-link to="/regist"> <span>去注册</span> </router-link>
        <span> 忘记密码</span>
      </p>
    </div>
    <div class="way">
      <span class="iconfont icon-weixin"></span>
      <span class="iconfont icon-QQ"></span>
    </div>

  </div>
</template>

<script>
  import axios from "axios";
  import Vue from "vue";

  import { Toast } from "vant";
  Vue.use(Toast);
  export default {
    name: "denglu",
    data() {
      return {
        userPhone: "18791636821",
        userPassword: "123456",
      };
    },
    methods: {
      denglvFn() {
        // 登录验证
        axios({
          url: "/user/login",
          method: "POST",
          data: {
            //地址栏数据
            userPhone: this.userPhone,
            userPassword: this.userPassword,
          },
          headers: {
            "Content-Type": "application/json",
          }, //php 默认要求传递请求头
        }).then((res) => {
          if (res.data.code == 0) {
            Toast.success("登录成功");
            this.$cookies.set("passPhone", this.userPhone);
            this.$cookies.set("username", "一罐啤酒");
            setTimeout(() => {
              this.$router.push("/Person");
              // this.$router.push("$router.back(-1))")
            }, 1000);
          } else if (res.data.code == 1) {
            Toast.fail("登录失败");

            // 失败
          }
        });
      },
    },
  };
</script>

<style scoped>
  #box {
    height: 100%;
    background-color: #fff;
    font-size: 0.14rem;
  }
  .head-box {
    height: 0.44rem;
    background-color: #fff;
    font-size: 0.14rem;
    padding: 0.16rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .head-box span {
    font-size: 0.18rem;
    color: red;
  }
  .m-box {
    height: 4.75rem;
    background-color: #fff;
    padding: 0 0.22rem;
  }
  .welcom {
    font-size: 0.26rem;
    height: 1.25rem;
    line-height: 1.25rem;
  }
  .tel-number {
    height: 0.48rem;
    line-height: 0.48rem;
    border-bottom: 1px solid #979797;
    background-color: #fff;
  }
  .tel-number span {
    font-size: 0.11rem;
    margin-top: 0.05rem;
    margin-bottom: 0.48rem;
  }
  .tel-number input {
    font-size: 0.14rem;
    height: 0.44rem;
    text-decoration: none;
    border: 0;
    line-height: 0.44rem;
    padding-left: 0.1rem;
  }
  .weizhuce {
    color: #979797;
    margin-bottom: 0.48rem;
    margin-top: 0.05rem;
  }
  .agree {
    height: 0.5rem;
    display: flex;
    justify-content: flex-start;
    font-size: 12px;
    color: #979797;
    line-height: 0.18rem;
    margin-top: 0.4rem;
  }
  .agree input {
    margin-top: 0.05rem;
  }
  .agree span {
    display: inline-block;
    width: 2.56rem;
    height: 0.46rem;
    margin-left: 0.05rem;
  }
  .agree span i {
    color: #dd4d41;
  }
  .denglv {
    height: 0.46rem;
    /* width: 2.96rem; */
    background-color: #dd4d41;
    color: #fff;
    line-height: 0.46rem;
    text-align: center;
    border-radius: 0.05rem;
    margin-top: 0.1rem;
    margin-bottom: 0.3rem;
  }
  .mima {
    font-size: 0.12rem;
    color: #262626;
    display: flex;
    justify-content: space-between;
  }
  .m-box .mima span:nth-child(1) {
    color: red;
  }
  .way {
    width: 1.1rem;
    height: 0.5rem;
    background-color: #fff;
    margin: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.4rem;
  }
  .way .iconfont {
    font-size: 0.38rem;
  }

  .way span {
    border: 0.01rem solid #979797;
    border-radius: 50%;
  }
  .way span:nth-child(1) {
    background-color: #72bf51;
  }
  .way span:nth-child(2) {
    background-color: #54b5e1;
  }
  .icon-weixin {
    color: #fff;
  }
  .icon-QQ {
    color: #fff;
  }
</style>

